public class Test {
    public int firstUniqChar(String s) {
        int[] a = new int[26];
        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            a[ch - 'a']++;
        }
        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            if (a[ch - 'a'] == 1) return i;
        }
        return -1;
    }

    public static void main(String[] args) {
        BinarySearchTree binarySearchTree = new BinarySearchTree();
        binarySearchTree.insert(7);
        binarySearchTree.insert(2);
        binarySearchTree.insert(4);
        binarySearchTree.insert(6);
        binarySearchTree.insert(3);
        binarySearchTree.insert(1);
        binarySearchTree.insert(5);
        binarySearchTree.insert(8);
        System.out.println("========");
    }
}
